
<div class="from-add-01">
<h2><?php  echo $this->page_title; ?></h2>
	<form name="frmuser" action="/profile/save-user" method="post" onsubmit="return checkValid()">
	<input type="hidden" name="id" value="<?php echo $this->userInfo['consultant_id']; ?>">
		<ul>
			<li>
			<label>&nbsp;</label>
			<em class="error"><?php echo @$this->msg;?></em>
			</li>
			<li>
				<label>Full Name:<em>*</em></label>
				<select style="width: 60px;" name="title">
					<option value="Mr." selected="selected">Mr.</option>
					<option value="Mrs.">Mrs.</option>
					<option value="Ms.">Ms.</option>
				</select>
				<input id="full_name" type="text" name="full_name" value="<?php echo $this->userInfo['full_name']; ?>" style="width : 185px;">
			</li>
			<li>
				<label>Job title:</label>
				<input id="job_title" type="text" name="job_title" value="<?php echo $this->userInfo['job_title']; ?>">
			</li>
			<li>
				<label>Tel:</label>
				<input type="text" id="phone" name="phone" value="<?php echo $this->userInfo['phone']; ?>">
			</li>
            <?php if( !$this->userInfo['consultant_id']): ?>
			<li>
				<label>Username:<em>*</em></label>
				<input type="text" id="username" name="username" value="<?php echo $this->userInfo['username']; ?>">
			</li>
			<li>
				<label>Password:<em>*</em></label>
				<input type="password" id="password" name="password">
			</li>
            
			<li>
				<label>Email:</label>
				<input type="text" id="email" name="email" value="<?php echo $this->userInfo['email']; ?>">
			</li>
            <?php else :?>
            <li>
                <label>Username:<em>*</em></label>
                <input type="text" id="username" name="username" value="<?php echo $this->userInfo['username']; ?>" disabled="disabled">
            </li>
            <li>
                <label>Email:</label>
                <input type="text" id="email" name="email" value="<?php echo $this->userInfo['email']; ?>" disabled="disabled">
            </li>
            <?php endif;?>
            
			<li>
				<label></label>
				<input class="button01" type="submit" name="edit" value="Save"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
				<a href="/profile" style="text-decoration:none;"><input class="button02" type="button"  value="Cancel"></a>
			</li>
		</ul>
	</form>
</div>
<script>
	function checkValid()
	{
		var full_name = $("#full_name").val();
		var username = $("#username").val();
		var password = $("#password").val();
		var email = $('#email').val();
		
		if(full_name == '' || username == '' || password == '')
		{
			$('.error').html('Please input into field required (*)');
			return false;
		} 

		 var check = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
		    if(!check.test(email))
		    {
		    	$('.error').html('please enter a valid email address');
		    	return false;
		    }
		    
		return true;
	}
</script>